// pages/gk_examInfo/gk_examInfo.js
Page({
  data: {
    // 定义页面映射对象
    pageMap: {
      grid1: '/pages/zikao/zk_exam_registrationInfo/zk_exam_registrationInfo',
      grid2: '/pages/zikao/zikao_info_pages/pre_education/pre_education',
      grid3: '/pages/zikao/zikao_info_pages/major/major',
      grid4: '/pages/zikao/zikao_info_pages/city/city',
      grid5: '/pages/zikao/zikao_info_pages/site/site',
      grid6: '/pages/zikao/zikao_info_pages/address/address'
    },
    bannerList: [
      { src: "/icon/huiyi2.jpg" },
      { src: "/icon/test2.jpg" },
      { src: "/icon/test3.jpg" }
    ],
  },

  // 跳转函数
  // 统一跳转函数，根据 data-type 获取跳转路径
  gotoPage(e) {
    const type = e.currentTarget.dataset.type;
    const url = this.data.pageMap[type];
    if (url) {
      console.log("page url :",url)
      wx.navigateTo({
        url: url,
        success: res => console.log('跳转成功:', url, res),
        fail: err => console.error('跳转失败:', err, url)
      });
    } else {
      console.error('未找到对应的页面路径，type:', type);
    }
},
});
